﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Framework.Db;
using System.Collections.Specialized;
using System.Data;
using Framework.Kit;

namespace BLL.Service
{
    /// <summary>
    /// 终端服务
    /// </summary>
    public class teminalService : DbBase
    {
        Model.teminalModel teminal = new Model.teminalModel();
        List<Model.teminalModel> l = new List<Model.teminalModel>();

        public teminalService()
        {
            this.tb = teminal.tb;
            l.Clear();
        }

        /// <summary>
        /// 获取终端列表
        /// </summary>
        /// <returns></returns>
        public List<Model.teminalModel> SelectAll()
        {
            try
            {
                string sql = string.Format("SELECT * FROM {0}", this.tb);
                DataTable dt = this.queryDtSQL(sql);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    l.Add(new Model.teminalModel
                    {
                        Seatnumber = dt.Rows[i]["SEATNUMBER"].ToString(),
                        Ip = dt.Rows[i]["IPADDRESS"].ToString()
                    });
                }
                return l;
            }
            catch (Exception ex)
            {
                other.WriteErrLog("获取终端列表信息", ex);
                return null;
            }
        }
    }
}